# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=python-quart-cors
pkgver=0.5.0
pkgrel=5
pkgdesc='A Quart extension to provide Cross Origin Resource Sharing, access control, support'
url=https://gitlab.com/pgjones/quart-cors
arch=(any)
license=(MIT)
depends=(
  python
  python-quart
)
makedepends=(
  git
  python-build
  python-installer
  python-poetry-core
)
checkdepends=(
  python-pytest
  python-pytest-asyncio
  python-pytest-cov
  python-pytest-sugar
  python-tox
)
_tag=597b48b6bf0cd6a73327f05063915aca4afc0662
source=(git+https://gitlab.com/pgjones/quart-cors.git#tag=${_tag})
sha256sums=(SKIP)

prepare() {
  cd quart-cors
  git cherry-pick -n ba39c2f3ffad89c4a9761d838c5d4f10048b6cc5
  git cherry-pick -n 5f7568c3843f1df71916424d98a944110cf1d7b2
  git cherry-pick -n eaedcc2b8698b28602849e8fd0f35e9d615a2e42
  git cherry-pick -n dcd8d6bee19c155c62409c264ddb7a5002bd98de
  git cherry-pick -n d879adcbbc45180fbc420ec2b4d5a28d395d5a60
  git cherry-pick -n d27921855ba8a23c141d52d10a6401db0c9a1fc9
  git cherry-pick -n 8555bdfc4a69f11ffd266f62eccbc0a3ab63bb38
  rm tests/test_websocket.py
}

pkgver() {
  cd quart-cors
  git describe --tags
}

build() {
  cd quart-cors
  python -m build --wheel --no-isolation
}

check() {
  cd quart-cors
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  SETUPTOOLS_USE_DISTUTILS=stdlib \
  tox -e "py${python_version}"
}

package() {
  python -m installer --destdir="${pkgdir}" quart-cors/dist/*.whl
  install -Dm 644 quart-cors/LICENSE -t "${pkgdir}"/usr/share/licenses/python-quart-cors/
}

# vim: ts=2 sw=2 et:
